<template>
  <view>
    <view @click="show = true"
      ><up-search
        v-model="deprops.query.pickTypeName"
        placeholder="请选择领料类型"
        :clearabled="true"
        :showAction="false"
        disabled
    /></view>
    <up-picker
      :show="show"
      :columns="compickerlists"
      @confirm="confirm"
      @cancel="show = false"
    ></up-picker>
  </view>
</template>

<script setup>
import { useMemberStore } from "@/stores/modules/member";
const deprops = defineProps(["query"]);
const show = ref(false);
const memberStore = useMemberStore();
const compickerlists = ref([]);
const confirm = (e) => {
  deprops.query.pickTypeName = e.value[0];
  const obj = memberStore.pickTypeLists.find(
    (item) => item.label == deprops.query.pickTypeName
  );
  deprops.query.pickType = obj ? obj.value : "";
  show.value = false;
};
onMounted(async () => {
  await Promise.all([memberStore.apiDictfnDetail("pick_type")]);
  compickerlists.value = [
    memberStore.pickTypeLists
      .filter((item) => item.value != 2)
      .map((item) => item.label),
  ];
});
</script>

<style lang="sass" scoped>
</style>